

#pragma once
#include "resource.h"
#include "stdafx.h"
#include "Bot.h"
#include "Game.h"
#include "GameWorld.h"
#include "PhysicalProperties.h"
#include "SpriteManager.h"
#include "GameTimer.h"
void Bot::update(Game *game)
{
	if(animatedSprite->getCurrentState() == RUNNING_LEFT)
	{
		animatedSprite->getPhysicalProperties()->incX(-1);
	}
	else if(animatedSprite->getCurrentState() == RUNNING_RIGHT)
	{
		animatedSprite->getPhysicalProperties()->incX(1);
	}
	else if(animatedSprite->getCurrentState() == STANDING_LEFT ||
		animatedSprite->getCurrentState() == STANDING_RIGHT)	
	{
	}
	
	int playerX	= (game->getWorld()->getSpriteManager()->getPlayer()->getPhysicalProperties()->getX());
	int playerY	= (game->getWorld()->getSpriteManager()->getPlayer()->getPhysicalProperties()->getY());
	
	if((playerX <= (int)animatedSprite->getPhysicalProperties()->getX()+5 &&	
				playerX >= (int)animatedSprite->getPhysicalProperties()->getX()-5) && 
				playerY <= (int)animatedSprite->getPhysicalProperties()->getY()+64 &&	
				playerY >= (int)animatedSprite->getPhysicalProperties()->getY()-64 )	
	{
		if(animatedSprite->getCurrentState() != 4)
			game->changeGameState(GAME_OVER_STATE);
	}
}
